var fs = require('fs');
var request = require('request');


exports.upload = function(req,res){
    var path = req.query.path;
    var space = req.query.space;
    var fileName = req.query.name;
    fs.createReadStream(path)
        .pipe(request.post('http://10.2.9.11:9797/spaces/'+ space +'/input/'+fileName).on('response', function (response) {
            response.on('data',function(trunck){
                var t = JSON.parse(trunck.toString());
                console.log('uploadstate : ' + t.uploadstate);
            });
        }));

};
